<?php
/**
 * Comment - hide data in block.
 *
 * Parameters:
 *  - [show]: print text as html comment (<!-- ... -->)
 *
 * @version 1.0
 * @link http://templum.googlecode.com
 * @license Apache License 2.0 http://www.apache.org/licenses/LICENSE-2.0
 * @author Anton Danilchenko <anton.danilchenko@gmail.com>
 */
class Templum_Component_Block_Comment extends Templum_Component_Block_Abstract {
    protected $_required = array();

    protected function _handle(array $params=array(), $content) {
        // show text as comment
        if (isset ($params['show']) AND $params['show']) {
            // delete close tag
            $content = str_replace('-->', '', $content);
            // return html comment
            return "<!-- {$content} -->";
        }
        // return empty place
        return '';
    }
}